import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '消息时间',
    align: "center",
    dataIndex: 'releaseTime'
  },
  {
    title: '平台',
    align: "center",
    dataIndex: 'platform_dictText'
  },
  {
    title: '消息类型',
    align: "center",
    dataIndex: 'messageType',
    customRender:({text}) =>{
      let str=''
      if (text===1){
        str='小说推荐'
      }else if (text===2){
        str='活动推荐'
      }else if (text===3){
        str='系统消息'
      }
      return str
    },
  },
  {
    title: '消息标题',
    align: "center",
    dataIndex: 'messageTitle'
  },
  {
    title: '发布状态',
    align: "center",
    dataIndex: 'releaseStatus',
    customRender:({text}) =>{
      return text?'已发布':'未发布'
    },
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "发布时间",
    field: "releaseTime",
    component: 'RangePicker',
    componentProps: {
      showTime: true,
    },
    colProps: {span: 6},
  },
  {
    label: "平台取字典platform",
    field: 'platform',
    component: 'JDictSelectTag',
    componentProps:{
    },
    colProps: {span: 6},
  },
  {
    label: "消息类型 1=小说推荐为小说ID 2=活动推荐 3=系统消息",
    field: 'messageType',
    component: 'JDictSelectTag',
    componentProps:{
    },
    colProps: {span: 6},
  },

];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '平台取字典platform',
    field: 'platform',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: ""
    },
  },
  {
    label: '消息类型 1=小说推荐为小说ID 2=活动推荐 3=系统消息',
    field: 'messageType',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: ""
    },
  },
  {
    label: '消息标题',
    field: 'messageTitle',
    component: 'Input',
  },
  {
    label: '消息内容',
    field: 'messageContent',
    component: 'Input',
  },
  {
    label: '发布状态 是否发布0=否 1=是',
    field: 'releaseStatus',
    component: 'InputNumber',
  },
  {
    label: '消息H5链接',
    field: 'messageH5',
    component: 'Input',
  },
  {
    label: '图片',
    field: 'img',
    component: 'JImageUpload',
    componentProps:{
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
